// pages/list/list.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    list: [{
      id: 'basics',
      name: '基础组件',
      open: false,
      pages: ['flex', 'panel','accordion', 'skeleton', 'pagination', 'timeline','list', 'tabs', 'icon', 'sticky','card'],
      zhcn: ['栅格布局', '图文面板','手风琴',  '骨架屏', '分页器', '时间轴', '列表', '标签', '图标', '吸顶','卡片']
    },
    {
      id: 'modal',
      name: '提示组件',
      open: false,
      pages: ['toast', 'toptips', 'actionsheet', 'dialog', 'loading'],
      zhcn: ['状态提示',  '顶部提示','弹出框', '提示框' ,'加载']
    },
    {
      id: 'form',
      name: '表单组件',
      open: false,
      pages: ['picker', 'progress','select','vcode','button', 'form', 'uploader', 'searchbar','rater'],
      zhcn: ['多列选择器', '进度条','下拉框','验证码','按钮', '表单', '上传', '搜索',   '评分']
    },
    {
      id: 'business',
      name: '业务组件',
      open: false,
      pages: ['anchorPoint', 'calendar','car'],
      zhcn: ['锚点返回','日历打卡','购物车']
    }
    ]
  },
  kindToggle: function (e) {
    var id = e.currentTarget.id, list = this.data.list;
    for (var i = 0, len = list.length; i < len; ++i) {
      if (list[i].id == id) {
        list[i].open = !list[i].open
      } else {
        list[i].open = false
      }
    }
    this.setData({
      list: list
    });
  }
})